package cn.bone.motan.demo2.config;

import com.weibo.api.motan.config.springsupport.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;

/**
 * Created by MD-01 on 2017/3/9.
 */
@Configuration
@ImportResource(locations = {"classpath:motan-client.xml"})
public class Config {

    /*@Bean
    public static AnnotationBean motanAnnotationBean(){
        AnnotationBean motanAnnotationBean = new AnnotationBean();
        motanAnnotationBean.setPackage("cn.bone.motan.**");
        return motanAnnotationBean;
    }

    @Bean(name="demoMotan")
    public ProtocolConfigBean protocolConfig(){
        ProtocolConfigBean config = new ProtocolConfigBean();
        config.setDefault(true);
        config.setName("motan");
        config.setMaxContentLength(1048576);
        return config;
    }

    @Bean(name="registryConfig")
    public RegistryConfigBean registryConfig(){
        RegistryConfigBean config = new RegistryConfigBean();
        config.setRegProtocol("consul");
        config.setName("my_consul");
        config.setAddress("127.0.0.1:8500");
        return config;
    }

    @Bean(name="clientBasicConfig")
    public BasicRefererConfigBean basicRefererConfig(){
        BasicRefererConfigBean config = new BasicRefererConfigBean();
        config.setProtocol("demoMotan");
        config.setGroup("motan-rpc");
        config.setModule("motan-rpc");
        config.setApplication("bone");
        config.setRegistry("registryConfig");
        config.setCheck(false);
        config.setAccessLog(true);
        config.setRetries(2);
        config.setThrowException(true);
        return config;
    }*/
}
